Skip to content

Conversation

theanarkh
Copy link
Contributor

Refs: #59807

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/web-infra

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Oct 12, 2025
@theanarkh theanarkh force-pushed the add_v8_heap_profile branch from 70788c9 to 9024efa Compare October 12, 2025 16:47
Copy link

codecov bot commented Oct 12, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.57%. Comparing base (f9fcc74) to head (9024efa).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/util.cc 68.88% 10 Missing and 4 partials ⚠️
lib/v8.js 82.14% 5 Missing ⚠️
src/node_v8.cc 87.50% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #60231   +/-   ##
=======================================
  Coverage   88.56%   88.57%           
=======================================
  Files         704      704           
  Lines      208125   208176   +51     
  Branches    40003    40019   +16     
=======================================
+ Hits       184332   184386   +54     
- Misses      15809    15822   +13     
+ Partials     7984     7968   -16     
Files with missing lines Coverage Δ
src/node_worker.cc 82.41% <100.00%> (+0.71%) ⬆️
src/node_worker.h 91.66% <ø> (ø)
src/util.h 90.59% <ø> (ø)
src/node_v8.cc 81.78% <87.50%> (+0.27%) ⬆️
lib/v8.js 98.15% <82.14%> (-0.88%) ⬇️
src/util.cc 84.26% <68.88%> (-1.42%) ⬇️

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -279,6 +279,30 @@ void StopCpuProfile(const FunctionCallbackInfo<Value>& args) {
}
}

void StartHeapProfile(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
if (isolate->GetHeapProfiler()->StartSamplingHeapProfiler()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StartSamplingHeapProfiler returns false if a sampling heap profiler is already running, we should check the value if false we stop this operation.
https://v8docs.nodesource.com/node-6.17/d7/d76/classv8_1_1_heap_profiler.html#ada00bb7ec0b7827ce97280a1fb6e1f64

Copy link
Contributor Author

@theanarkh theanarkh Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing ! An Error will be thrown in the following code when false is returned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is when we ask to start a new heap profiler should we stop the previous one?

Copy link
Contributor Author

@theanarkh theanarkh Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stopping the previous one will discard the profile data. I think it's better to throw an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants